package Taulak;

import java.util.Vector;

import javax.swing.table.AbstractTableModel;

public class MTBKonfBarietatea extends AbstractTableModel {

	private Vector<String> columnNames = new Vector<String>();
	private Vector<LagKonfBarietatea> data = new Vector<LagKonfBarietatea>();

	public MTBKonfBarietatea() {

		izenakHasieratu();
	}

	public void izenakHasieratu() {

		columnNames.add("Barietatea");
	
		
	}

	public String getColumnName(int column) {
		return columnNames.elementAt(column);
	}

	@Override
	public int getColumnCount() {

		return columnNames.size();
	}

	public int getRowCount() {

		return data.size();

	}

	@Override
	public Object getValueAt(int ler, int zut) {

		LagKonfBarietatea l = data.elementAt(ler);
		Object ema = l.getBalioa(zut);
		return (ema);

	}

	public void kargatu(String barietatea) {

		LagKonfBarietatea l = new LagKonfBarietatea(barietatea);
		data.add(l);

		fireTableDataChanged();

	}

	public void ezabatu(int lerroa) {
		data.remove(lerroa);
		fireTableDataChanged();
	}

	public void taulaHasieratu(int ler) {

		while (ler > 0) {

			data.remove(0);
			ler--;
		}

		fireTableDataChanged();

	}


	

}